package com.kantboot.functional.pay.order.emit;

import com.kantboot.functional.pay.order.event.PayEmitEvent;
import com.kantboot.functional.pay.order.module.entity.FunctionalPayOrder;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * 支付订单事件
 */
@Service
public class PayEmit implements Serializable {

    private final ApplicationEventPublisher applicationEventPublisher;

    public PayEmit(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    public void emit(FunctionalPayOrder payOrder) {
        applicationEventPublisher.publishEvent(new PayEmitEvent(this, payOrder));
    }

}
